package com.jason.quectel.activities;

import android.os.Bundle;

import com.jason.quectel.R;
import com.jason.quectel.adapter.SecondAdapter;
import com.jason.quectel.bean.ArticleBean;

import java.util.ArrayList;
import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class SecondActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        RecyclerView recyclerview = findViewById(R.id.recyclerview);
        recyclerview.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        SecondAdapter adapter = new SecondAdapter();
        recyclerview.setAdapter(adapter);
        adapter.setData(getData());
    }

    private List<ArticleBean> getData() {
        List<ArticleBean> list = new ArrayList<>();
        ArticleBean bean;
        for (int i = 0; i < 50; i++) {
            bean = new ArticleBean();
            bean.title = "标题" + i;
            bean.imageResId = R.mipmap.ic_launcher;
            list.add(bean);
        }
        return list;
    }
}